#ifndef _MPU_TIME_INIT_H_
#define _MPU_TIME_INIT_H_

#include "stm32f4xx.h"    

#define LIMIT( x,min,max ) ( (x) < (min)  ? (min) : ( (x) > (max) ? (max) : (x) ) )

#define PWM1  TIM2->CCR2
#define PWM2  TIM1->CCR1
#define PWM3  TIM3->CCR2

#define InitFrictionWheel()     \
        PWM1 = 50;             \
        PWM2 = 50;
#define SetFrictionWheelSpeed_big(x) \
        PWM1 = x;                
#define SetFrictionWheelSpeed_small(x) 	\
        PWM2 = x;
#define SetImuTemp(x) 	\
        PWM3 = x;			
		
typedef struct
{
  float Last_Time;
  float Now_Time;
  float Time_Delta;
}TIME_Handle;


u8 PWM_Out_Init_TIM1(uint16_t hz);
u8 PWM_Out_Init_TIM2(uint16_t hz);
u8 PWM_Out_Init_TIM3(uint16_t hz);
void TIM7_Configuration(void);
void TIM8_Configuration(void);
uint32_t Get_Time_Micros(void);
double Get_Sys_Ticks(void);
float Get_Sys_Ticks_float_ms(void);


#endif


